<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>{$pagetitle}</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  <link rel="stylesheet" href="/static/admin/layui/css/layui.css" media="all">
  <link rel="stylesheet" href="/static/admin/style/global.css" media="all">
  <style>
	  .layui-form-label{ width:10%;}
	  .layui-form-item .layui-input-inline{width: 80%;}
  </style>  
</head>
<body>
		<form action="{:url()}" method="post" class="form-horizontal" onsubmit="return this_submit(this)">
			<div class="layui-card">
				<div class="layui-card-body">
					<div class="layui-tab layui-tab-card">
						<ul class="layui-tab-title">
							<li class="layui-this">基本设置</li>
							<li>SEO设置</li>
						</ul>
						<div class="layui-tab-content">


							<div class="layui-tab-item layui-show">
								
	<input type="hidden" name="pubid" value="{$pubid}" />
  <div class="layui-form" lay-filter="layuiadmin-app-form-list" id="layuiadmin-app-form-list" style="padding: 20px 30px 0 0;">
    <div class="layui-form-item">
      <label class="layui-form-label">单页名称</label>
      <div class="layui-input-inline">
        <input type="text" lay-verify="required" name="name" autocomplete="off" class="layui-input">
      </div>
    </div>
	
    <div class="layui-form-item">
      <label class="layui-form-label">页面模式</label>
	  <div class="layui-input-inline">
		  <div class="layui-col-md12">
			<input type="radio" lay-filter="pagemod" name="pagemod" value="1" title="直接页面式" {if $Request.param.pagemod==1}checked{/if}>
			<input type="radio" lay-filter="pagemod" name="pagemod" value="2" title="采用模板式" {if $Request.param.pagemod==2}checked{/if}>
		  </div>
	  </div>
    </div>	
	
    <div class="layui-form-item">
      <label class="layui-form-label">页面名称</label>
      <div class="layui-input-inline">
        <input type="text" lay-verify="required" name="title" autocomplete="off" class="layui-input">
      </div>
    </div>

	
    <div class="layui-form-item">
      <label class="layui-form-label">URL路径<span>仅支持：英文，字母，下划线</span></label>
      <div class="layui-input-inline">
        <input type="text" lay-verify="required" name="classpath" autocomplete="off" class="layui-input">
      </div>
    </div>	
	{if $Request.param.pagemod==2}
		<div class="layui-form-item">
		  <label class="layui-form-label">页面模板</label>
		  <div class="layui-input-inline">
				<select name="template_id" class="layui-input">
					<option value="">请选择模板</option>
					{foreach $pagetemp as $v}
						<option value="{$v.template_id}">{$v.name}</option>
					{/foreach}
				</select>
		  </div>
		</div>	
	{/if}
	<div class="layui-form-item">
	  <label class="layui-form-label">缩略图<span></span></label>
	  <div class="layui-input-inline file-upload">
			<input type="text" name="thumb" id="info_thumb" value="" autocomplete="off" class="layui-input"/>
			<div class="layui-btn-group">
				<button type="button" class="layui-btn" onclick="previewImg('info_thumb')"><i class="layui-icon">&#xe64a;</i>预览</button>
				<button type="button" class="layui-btn fastupimg" data-input_id="info_thumb" data-listtype="img" id="info_thumb_Picker"><i class="layui-icon">&#xe608;</i>上传</button>
				<button type="button" class="layui-btn" onClick="selectfile('info_thumb','','img')"><i class="layui-icon">&#xe67c;</i>浏览</button>
			</div>
	  </div>
	</div>	
	{if $Request.param.pagemod==1}
    <div class="layui-form-item">
      <label class="layui-form-label">模板内容</label>
      <div class="layui-input-inline"><textarea name="pagetext" id="template_editor"  class="span11" style="height:500px;"></textarea></div>
    </div>
	{else/}
	<div class="layui-form-item">
	  <label class="layui-form-label">详情</label>
	  <div class="layui-input-inline">
			<div class="news_editor" editor_name="pagetext" editor_width="0%" editor_height="500" imgwidth="1000" imgheight=""><script id="pagetext" name="pagetext" type="text/plain"></script></div>
	  </div>
	</div>
	{/if}	
	
								</div>
							</div>
							
							

							<div class="layui-tab-item">

								<input type="hidden" name="page_id" value="{$r.page_id}" />
								<input type="hidden" name="pubid" value="{$r.pubid}" />
								<div class="layui-form" lay-filter="layuiadmin-app-form-list" id="layuiadmin-app-form-list" style="padding: 20px 30px 0 0;">
									<div class="layui-form-item">
										<label class="layui-form-label">SEO标题</label>
										<div class="layui-input-inline">
											<input type="text" name="pagetitle" autocomplete="off" class="layui-input">
										</div>
									</div>
									<div class="layui-form-item">
										<label class="layui-form-label">网页关键词</label>
										<div class="layui-input-inline">
											<input type="text" name="pagekey" autocomplete="off" class="layui-input">
										</div>
									</div>
									<div class="layui-form-item">
										<label class="layui-form-label">网页描述</label>
										<div class="layui-input-inline">
											<textarea name="pagedes" style="height: 200px;" autocomplete="off" class="layui-input"></textarea>
										</div>
									</div>																		

								</div>
							</div>	
	
	<div class="layui-form-item layui-layout-admin" style="margin-top: 30px;">
		<div class="layui-input-block">
		   <div class="layui-footer" style="left: 0;">
			  <button class="layui-btn" type="submit">立即提交</button>
			  <button type="reset" class="layui-btn layui-btn-primary close">关闭</button>
			  <a type="button" class="layui-btn layui-btn-primary">变量说明</a>
		  </div>
		</div>
	</div>  

						</div>
					</div>
		</form>
  <script src="/static/admin/layui/layui.js"></script>
  <script src="/static/js/jquery.min.js"></script>    
  <script src="/static/js/globals.js"></script>  
<!--文件上传 start-->
<script type="text/javascript" src="/static/webuploader/kinderfile.js"></script>
<script type="text/javascript" src="/static/webuploader/Sortable.js"></script>    
<script type="text/javascript" src="/static/webuploader/morepic.js"></script>   


<!--以下是针对 快速上传单个文件插件-->  
<link rel="stylesheet" type="text/css" href="/static/webuploader/style/webuploader.css" />
<link rel="stylesheet" type="text/css" href="/static/webuploader/style/style.css" />
<script type="text/javascript" src="/static/webuploader/webuploader.js"></script>
<script type="text/javascript" src="/static/webuploader/fastupimg.js"></script>
<!--文件上传 end-->
<!--文件上传的预览功能中中也需要用到我 fancybox plus start-->
<link rel="stylesheet" type="text/css" href="/static/fancybox/jquery.fancybox-1.3.4.css" media="screen" />	
<script type="text/javascript" src="/static/fancybox/jquery.mousewheel-3.0.4.pack.js"></script>
<script type="text/javascript" src="/static/fancybox/jquery.fancybox-1.3.4.pack.js"></script>
<!--文件上传的预览功能中中也需要用到我 fancybox plus end-->  
<!--编辑器开始-->
<script src="/static/ueditor/ueditor.config.js"></script> 
<script src="/static/ueditor/ueditor.all.js"></script> 
<script>
    $(function () {
        //循环实例化编辑器
        $(".news_editor").each(function(){
            var editor_name=$(this).attr("editor_name");
            var editor_width=$(this).attr("editor_width");
            var editor_height=$(this).attr("editor_height");
            var imgwidth=$(this).attr("imgwidth");
            var imgheight=$(this).attr("imgheight");
            var ue = UE.getEditor(editor_name, {
				zIndex:1,
                initialFrameHeight: editor_height>0?editor_height:"0",
                initialFrameWidth: editor_width>0?editor_width:'90%',
                imgwidth: imgwidth,
                imgheight: imgheight,
            });
        })

    })
</script>  
<!--编辑器结束-->
  <script>
  layui.config({
    base: '/static/admin/' //静态资源所在路径
  }).extend({
    index: 'lib/index' //主入口模块
  }).use(['index', 'form'], function(){
    var $ = layui.$
    ,form = layui.form;
	form.on('radio(pagemod)', function(data){
	  if(data.value==1){
		  location.href="{:url(0,['pagemod'=>1])}";
	  }else{
		  location.href="{:url(0,['pagemod'=>2])}";
	  }
	});	
  })
	  
  </script>

  <!--代码编辑器插件-->
  <link rel="stylesheet" type="text/css" href="/static/admin/codemirror/lib/codemirror.css">
  <script src="/static/admin/codemirror/lib/codemirror.js"></script>
  <link rel="stylesheet" href="/static/admin/codemirror/theme/abcdef.css">
  <script>
    var editor = CodeMirror.fromTextArea(document.getElementById("template_editor"), {
      lineNumbers: true,
      styleActiveLine: true,
      matchBrackets: true,
      theme:"abcdef",
    }); 
  //提交表单
    function  this_submit(obj){
		{if $Request.param.pagemod==1}  
        $("#template_editor").val(editor.getValue());
		{/if}
        //这里为什么要延时的原因：因为editor.getValue()这个方法获取到代码需要时间计算的，如果不延时的话提交的是一个空值
        setTimeout(function(){
            save_form2(obj);
        },200);  
        return false;
    }  	 
  </script>

</body>
</html>